 
If WScript.Arguments.Count > 0 Then Filename = WScript.Arguments(0) 
Set a = CreateObject("Excel.Application") 
If Filename = "" Then 
Filename = a.GetOpenFilename("Excel Files (*.xlsx), *.xls") 
If VarType(Filename) = vbBoolean Then 
MsgBox "Excel2Txt用于将Excel文件的每个Sheet保存为一个文本文件。" & vbCr & vbLf & vbCr & vbLf & "用法: Excel2Txt filename.xls 或在对话框中打开Excel文件。" 
WScript.Quit 
End If 
End If 
Set w = a.Workbooks.Open(Filename) 
n = Replace(Replace(w.Name, ".xls", ""), ".XLS", "") 
a.DisplayAlerts = False 
For Each s In w.Sheets 
s.SaveAs w.Path & "\" & n & "_" & s.Name & ".txt", 20 
Next 
a.Quit 

